//
//  UIView+Error.m
//  LoadImageAnimation
//
//  Created by Burn on 2019/3/20.
//  Copyright © 2019 menksoft. All rights reserved.
//

#import "UIView+Error.h"
#import "ErrorView.h"
#import <objc/runtime.h>
@implementation UIView (Error)

const static char errorViewKey;

- (void)showErrorMsg:(NSString *)msg{
        self.errorView = nil;
        ErrorView *e = [[ErrorView alloc]init];
        [e showInView:self msg:msg after:2];
        self.errorView = e;
}

- (UIView *)errorView
{
    return objc_getAssociatedObject(self, &errorViewKey);
}

- (void)setErrorView:(UIView *)errorView{
    objc_setAssociatedObject(self, &errorViewKey, errorView, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

@end
